New installed header file containing class and typesystem definitions and
authorMartin Nordholts <martinn@src.gnome.org>
Sat, 17 Jan 2009 14:16:18 +0000 (14:16 +0000)
committerMartin Nordholts <martinn@src.gnome.org>
Sat, 17 Jan 2009 14:16:18 +0000 (14:16 +0000)
* babl/babl-class.h: New installed header file containing class
and typesystem definitions and types.

* babl/babl.h: Include it.

* babl/Makefile.am: Add it.

svn path=/trunk/; revision=374

ChangeLog
babl/Makefile.am
babl/babl-class.h [new file with mode: 0644]
babl/babl.h

index 7822438301c9ac7d56e0f238aac0d226fd8ee9c0..b6119a521ad7cdcd449b1ca1c4cc2adcb2fd9b28 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2009-01-17  Martin Nordholts  <martinn@svn.gnome.org>
+
+       * babl/babl-class.h: New installed header file containing class
+       and typesystem definitions and types.
+
+       * babl/babl.h: Include it.
+
+       * babl/Makefile.am: Add it.
+
 2009-01-17  Martin Nordholts  <martinn@svn.gnome.org>
 
        * babl/babl.h: Move up forward declaration of BablList.
index bf523916972635ed33ff8cf1f36ecbd617d4f9a4..b5b64f0828c69cb84fe7a3283406bf751b0660f1 100644 (file)
@@ -34,6 +34,7 @@ c_sources =                           \
        babl-version.c
 
 h_sources  =                           \
+       babl-class.h                    \
        babl-db.h                       \
        babl-ids.h                      \
        babl-internal.h                 \
@@ -49,6 +50,7 @@ h_sources  =                          \
 library_includedir=$(includedir)/babl-$(BABL_API_VERSION)/babl
 library_include_HEADERS =              \
        babl.h                          \
+       babl-class.h                    \
        babl-component.h                \
        babl-conversion.h               \
        babl-extension.h                \
diff --git a/babl/babl-class.h b/babl/babl-class.h
new file mode 100644 (file)
index 0000000..b8e11fd
--- /dev/null
@@ -0,0 +1,115 @@
+/* babl - dynamically extendable universal pixel conversion library.
+ * Copyright (C) 2005-2008, Øyvind Kolås and others.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General
+ * Public License along with this library; if not, see
+ * <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef _BABL_CLASS_H
+#define _BABL_CLASS_H
+
+#ifndef _BABL_H
+#error  this file is only to be included by babl.h
+#endif
+
+
+/* magic number used at the start of all babl objects, used to do
+ * differentiation in polymorphic functions. (as well as manual
+ * type check assertions).
+ */
+#define BABL_MAGIC   0xbab100
+
+enum {
+  BABL_INSTANCE = BABL_MAGIC,
+  BABL_TYPE,
+  BABL_TYPE_INTEGER,
+  BABL_TYPE_FLOAT,
+  BABL_SAMPLING,
+  BABL_COMPONENT,
+  BABL_MODEL,
+  BABL_FORMAT,
+
+  BABL_CONVERSION,
+  BABL_CONVERSION_LINEAR,
+  BABL_CONVERSION_PLANE,
+  BABL_CONVERSION_PLANAR,
+
+  BABL_FISH,
+  BABL_FISH_REFERENCE,
+  BABL_FISH_SIMPLE,
+  BABL_FISH_PATH,
+  BABL_IMAGE,
+
+  BABL_EXTENSION,
+
+  BABL_SKY
+};
+typedef int BablClassType;
+
+typedef union _Babl Babl;
+
+typedef int  (*BablEachFunction) (Babl *entry,
+                                  void *data);
+
+/* All Classes in babl have common functionality like the ability
+ * to be iterated over, common functionality is defined through these
+ * macros.
+ */
+#define BABL_CLASS_DECLARE(klass)                            \
+                                                             \
+void   babl_##klass##_init    (void);                        \
+void   babl_##klass##_destroy (void);                        \
+Babl * babl_##klass##_id      (int id);                      \
+void   babl_##klass##_each    (BablEachFunction  each_fun,   \
+                               void             *user_data)
+
+/* creates a class that has a specific name connected to it, that
+ * also allows defining a new instance. These classes share common
+ * functionality with the non_name classes but have two extra methods,
+ * the means to lookup by name, as well as to create new named objects
+ * that later can be looked up.
+ */
+#define BABL_NAMED_CLASS_DECLARE(klass)                      \
+                                                             \
+BABL_CLASS_DECLARE (klass);                                  \
+Babl * babl_##klass           (const char       *name);      \
+Babl * babl_##klass##_new     (void             *first_arg,  \
+                               ...) BABL_ARG_NULL_TERMINATED
+
+/* common header for any item inserted into database, the actual
+ * implementation of babl-instance is in babl-internal
+ */
+typedef struct
+{
+  BablClassType  class_type;
+  int            id;      /*< a numerical id, look at 'babl-ids.h' for the reserved
+                              ones */
+  void          *creator;
+  char          *name;    /*< the name this type exists under         */
+} BablInstance;
+
+/**
+ * babl_name:
+ *
+ * Return a string decsribing a BablInstance, might work better than
+ * babl->instance.name when a good human readable name is desired.
+ *
+ * Returns: a name describing the instance.
+ */
+const char * babl_name       (const Babl *babl);
+
+void         babl_introspect (Babl       *babl); /* introspect a given BablObject     */
+
+
+#endif
index e9c533968bce1f13f2aaafe75d503bfcc5046557..f67a856427b388f000f47cc9d6b2b36b7d94decf 100644 (file)
@@ -34,83 +34,7 @@ typedef struct _BablList BablList;
 
 #include "babl-macros.h"
 #include "babl-main.h"
-
-/* magic number used at the start of all babl objects, used to do
- * differentiation in polymorphic functions. (as well as manual
- * type check assertions).
- */
-#define BABL_MAGIC   0xbab100
-
-enum {
-  BABL_INSTANCE = BABL_MAGIC,
-  BABL_TYPE,
-  BABL_TYPE_INTEGER,
-  BABL_TYPE_FLOAT,
-  BABL_SAMPLING,
-  BABL_COMPONENT,
-  BABL_MODEL,
-  BABL_FORMAT,
-
-  BABL_CONVERSION,
-  BABL_CONVERSION_LINEAR,
-  BABL_CONVERSION_PLANE,
-  BABL_CONVERSION_PLANAR,
-
-  BABL_FISH,
-  BABL_FISH_REFERENCE,
-  BABL_FISH_SIMPLE,
-  BABL_FISH_PATH,
-  BABL_IMAGE,
-
-  BABL_EXTENSION,
-
-  BABL_SKY
-};
-typedef int BablClassType;
-
-typedef union _Babl Babl;
-
-typedef int  (*BablEachFunction) (Babl *entry,
-                                  void *data);
-
-/* All Classes in babl have common functionality like the ability
- * to be iterated over, common functionality is defined through these
- * macros.
- */
-#define BABL_CLASS_DECLARE(klass)                            \
-                                                             \
-void   babl_##klass##_init    (void);                        \
-void   babl_##klass##_destroy (void);                        \
-Babl * babl_##klass##_id      (int id);                      \
-void   babl_##klass##_each    (BablEachFunction  each_fun,   \
-                               void             *user_data)
-
-/* creates a class that has a specific name connected to it, that
- * also allows defining a new instance. These classes share common
- * functionality with the non_name classes but have two extra methods,
- * the means to lookup by name, as well as to create new named objects
- * that later can be looked up.
- */
-#define BABL_NAMED_CLASS_DECLARE(klass)                      \
-                                                             \
-BABL_CLASS_DECLARE (klass);                                  \
-Babl * babl_##klass           (const char       *name);      \
-Babl * babl_##klass##_new     (void             *first_arg,  \
-                               ...) BABL_ARG_NULL_TERMINATED
-
-
-
-/* common header for any item inserted into database, the actual
- * implementation of babl-instance is in babl-internal
- */
-typedef struct
-{
-  BablClassType  class_type;
-  int            id;      /*< a numerical id, look at 'babl-ids.h' for the reserved
-                              ones */
-  void          *creator;
-  char          *name;    /*< the name this type exists under         */
-} BablInstance;
+#include "babl-class.h"
 
 /**
  * babl_name: